var express = require('express');
var router = express.Router();
let { } = require('../model/model_zgh');
let multiparty = require('multiparty');

/* GET home page. */
router.get('/', function (req, res, next) {
  res.render('index', { title: 'Express' });
});


// 图片上传
router.post('/upload', (req, res) => {
  console.log(123);
  var form = new multiparty.Form();
  form.uploadDir = 'upload'
  form.parse(req, (err, a, b) => {
      console.log(b);
      res.send({
          path: 'http://localhost:3000/' + b.file[0].path
      })
  })
})



module.exports = router;
